#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H

#include "NetworkManager.h"


#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QMessageBox>

class LoginDialog : public QDialog
{
    Q_OBJECT

public:
    explicit LoginDialog(QWidget* parent = nullptr);
    void initUi();
    void connectsignalToSolt();
    QString getUsername() const;
    QString getPassword() const;
    QString getServerHost() const;
    quint16 getServerPort() const;

private slots:
    void onLoginClicked();
    void onCancelClicked();
    void setStyle();
    void onConnectServerClicked();
    void onRegisterClicked();

signals:
    void loginSignal(QString username, QString password);
    void connectServerSignal(QString host, quint16 port);

private:
    QLineEdit* m_usernameEdit;
    QLineEdit* m_passwordEdit;
    QLineEdit* m_serverHostEdit;
    QLineEdit* m_serverPortEdit;
    QPushButton* m_connectServerBtn;
    QPushButton* m_loginBtn;
    QPushButton* m_registerBtn;
    QPushButton* m_cancelBtn;
    QLabel* usernameLabel;
    QLabel* passwordLabel;
    QLabel* serverLabel;
    QLabel* portLabel;

    NetworkManager* m_networkManager;
};

#endif // LOGINDIALOG_H

